export class ScorePanel {
  private scoreElement: HTMLElement
  private levelElement: HTMLElement
  private score = 0
  private level = 1
  private point = 1
  constructor() {
    this.scoreElement = document.getElementById('score')!
    this.levelElement = document.getElementById('level')!
    this.scoreElement.innerText = 'Score：' + this.score
    this.levelElement.innerText = 'Level：' + this.level
  }
  addScore() {
    this.score += this.point
    this.scoreElement.innerText = 'Score：' + this.score
    this.addLevel()
  }
  addLevel() {
    let gaintpoint = 1
    if (this.level < 10) {
      this.level = Math.floor(this.score / gaintpoint) + 1
    } else {
      this.level = 10
    }
    this.levelElement.innerText = 'Level：' + this.level
  }
  get Level() {
    return this.level
  }
  get Score() {
    return this.score
  }
}
